#ifndef CONSTVIEW4FUN_H
#define CONSTVIEW4FUN_H

#include <QObject>
#include <QByteArray>
#include <QString>
#include <QtTypes>

#include "constview4color.h"
#include "constview4size.h"

#define QCSS_Input() QString::asprintf("QLineEdit{font-size:%dpx;font-family:Microsoft Yahei;border:1px solid #%08x;padding:2px;}"  \
                               "QLineEdit:hover{border:1px solid #%08x;}"  \
                               "QLineEdit:focus{border:1px solid #%08x;}"  \
                                         ,TextSize_ToolBar  \
                                         ,InputBordColor  \
                                         ,InputBordColor_over  \
                                         ,InputBordColor_focus  \
                                         )


#define DRAW_ICON_FontR3(LFT,TOP,TXTSIZE,TXTID)    \
quint32 textColor = isChecked ?  Color_Font_ToolBar_checked:Color_Font_ToolBar;  \
    int cx0, cy0,ntLeft,ntTop;  \
uint codeText = kepen::core::MenuIdConvert::GetIconTextByID(TXTID);  \
    QChar chTxt(codeText);  \
    QString szLabel(chTxt);  \
    font_t.setPointSize(TXTSIZE);  \
    cx0 = LFT + (childWidth >> 1);  \
    cy0 = TOP + (childHeight >> 1);  \
    ntLeft = cx0 - 1000;  \
    ntTop = cy0 - 500;  \
    QRect rect4Text(ntLeft, ntTop, 2000, 1000);  \
    QBrush brushText(QColor(QRgba64::fromArgb32(textColor)),Qt::SolidPattern);  \
    QPen penText(brushText,1, Qt::SolidLine);  \
    painter->setFont(font_t);  \
    painter->setBrush(Qt::BrushStyle::NoBrush);  \
    painter->setPen(penText);  \
    painter->drawText(rect4Text,Qt::AlignCenter,szLabel);


#define DRAW_ICON_FontR4(LFT,TOP,TXTSIZE,TXTID)  QFont &font_t = fontIcon;  \
quint32 textColor = isChecked ?  Color_Font_ToolBar_checked:Color_Font_ToolBar;  \
    int cx0, cy0,ntLeft,ntTop;  \
    uint codeText = kepen::core::MenuIdConvert::GetIconTextByID(TXTID);  \
    QChar chTxt(codeText);  \
    QString szLabel(chTxt);  \
    font_t.setPointSize(TXTSIZE);  \
    cx0 = LFT + (childWidth >> 1);  \
    cy0 = TOP + (childHeight >> 1);  \
    ntLeft = cx0 - 1000;  \
    ntTop = cy0 - 500;  \
    QRect rect4Text(ntLeft, ntTop, 2000, 1000);  \
    QBrush brushText(QColor(QRgba64::fromArgb32(textColor)),Qt::SolidPattern);  \
    QPen penText(brushText,1, Qt::SolidLine);  \
    painter->setFont(font_t);  \
    painter->setBrush(Qt::BrushStyle::NoBrush);  \
    painter->setPen(penText);  \
    painter->drawText(rect4Text,Qt::AlignCenter,szLabel);



#define QCSS_IconBtnTileHead() QString::asprintf("QPushButton{background-color:transparent;color:#%08x;border:0px;border-style:none}"  \
                                       "QPushButton:hover{background-color:#%08x;color:#%08x;}"  \
                                       "QPushButton:pressed{background-color: #%08x;color:#%08x;}"  \
                                       ,Color_HeadPanel_Text  \
                                       ,Color_HeadPanel_Over_BG  \
                                       ,Color_HeadPanel_OverText  \
                                       ,Color_HeadPanel_Down_BG  \
                                       ,Color_HeadPanel_Text)


#define QCSS_IconBtnTileHeadT(TD) QString::asprintf("QPushButton{background-color:transparent;color:#%08x;border:0px;border-style:none;font-size:%dpx;}"  \
                                       "QPushButton:hover{background-color:#%08x;color:#%08x;}"  \
                                       "QPushButton:pressed{background-color: #%08x;color:#%08x;}"  \
                                       ,Color_HeadPanel_Text,TD  \
                                       ,Color_HeadPanel_Over_BG  \
                                       ,Color_HeadPanel_OverText  \
                                       ,Color_HeadPanel_Down_BG  \
                                       ,Color_HeadPanel_Text)



#define QCSS_IconBtnToolBar() QString::asprintf("QPushButton{background-color:transparent;color:#%08x;border:0px;border-style:none;}"  \
                                       "QPushButton:hover{background-color:#%08x;color:#%08x;}"  \
                                       "QPushButton:pressed{background-color: #%08x;color:#%08x;}"  \
                                       ,ButtonText_Color  \
                                       ,Background_BtnOver  \
                                       ,TextColor_BtnOver  \
                                       ,Background_BtnDown  \
                                       ,TextColor_BtnDown)


#endif // CONSTVIEW4FUN_H
